import { memo } from 'react';
import type { ReactNode, FC } from 'react';
import { Link } from 'react-router-dom';

import { ListHeaderWrapper } from './style';
interface IProps {
  children?: ReactNode;
  name: string;
  moreLink: string;
}

const ListHeader: FC<IProps> = (props) => {
  const { name, moreLink } = props;
  return (
    <ListHeaderWrapper>
      <span>{name}</span>
      {moreLink && <Link to={moreLink}>查看更多{'>'}</Link>}
    </ListHeaderWrapper>
  );
};

export default memo(ListHeader);
